import { Children, lazy } from "react";
import { createBrowserRouter } from 'react-router-dom'
import {
  DesktopOutlined,
  FileOutlined,
  PieChartOutlined,
  TeamOutlined,
  UserOutlined,
} from '@ant-design/icons';
import Home from '../pages/home/Index'
import Login from '../pages/login/Index'
import Error from '../pages/404/Index'
let Index = lazy(() => import('../pages/index/Index'))
let Peropen = lazy(() => import('../pages/peropen/Index'))
let Setout = lazy(() => import('../pages/setout/Index'))
let Setout1 = lazy(() => import('../pages/setout/setout1/Index'))
let Setout2 = lazy(() => import('../pages/setout/setout2/Index'))
export let homeroutes = ([
  {
    path: '/home/index',
    element: <Index></Index>,
    title: 'Index',
    icon: <UserOutlined />
  },
  {
    path: '/home/peropen',
    element: <Peropen></Peropen>,
    title: 'Peropen',
    icon: <UserOutlined />
  },
  {
    path: '/home/setout',
    element: <Setout></Setout>,
    title: 'Setout',
    icon: <UserOutlined />,
    children: [
      {
        path: '/home/setout/setout1',
        element: <Setout1></Setout1>,
        title: 'Setout1',
        icon: <UserOutlined />
      },
      {
        path: '/home/setout/setout2',
        element: <Setout2></Setout2>,
        title: 'Setout2',
        icon: <UserOutlined />
      }
    ]
  },
])
let routes = createBrowserRouter([
  {
    path: '/',
    element: <Home></Home>,
    children: homeroutes
  },
  {
    path: '/home',
    element: <Home></Home>,
    children: homeroutes
  },
  {
    path: '/login',
    element: <Login></Login>,
  },
  {
    path: '*',
    element: <Error></Error>,
  }
])
export default routes